#include <iostream>
#include <math.h>
using namespace std;
template <typename T>
T yr_lin (T a, T b)
{
	
	float x=(-b)/a;
	return x;
}
template <typename T>
T yr_kvadratich (T a, T b, T c)
{	
	
	float D=((b*b)-(4*a*c));
	if (D>0)
	{
		float x1=((-b)+sqrt(D))/(2*a);
		cout<<"a*x2+b*x + c = 0 x1 = : "<<x1<<"\n";
		float x2=((-b)-sqrt(D))/(2*a);
		cout<<"a*x2+b*x + c = 0 x2 = : "<<x2<<"\n";
		return 0;
	}
	if (D==0)
	{
		float x3=(-b)/(2*a);
		cout<<"a*x2+b*x + c = 0  x3 = : "<<x3<<"\n";
		return 0;
	}
	if (D<0)
	{
		cout<<"a*x2+b*x + c = 0 korney net \n";
		return 0;
	}
}
void main ()
{
	float a, b, c,d;
	cout<<"enter 1 for quadratic equatio or 2 for linear equation : ";
	cin>>d;
	while(d==1)
	{
	cout<<"a:";cin>>a;cout<<"\n";
	if (a==0){continue;}
	cout<<"b:";cin>>b;cout<<"\n";
	cout<<"c:";cin>>c;cout<<"\n";
	yr_kvadratich(a,b,c);
	break;
	}
	while(d==2)
	{
	cout<<"a:";cin>>a;cout<<"\n";
	if (a==0){continue;}
	cout<<"b:";cin>>b;cout<<"\n";
	cout<<"a*x + b = 0 x=: "<<yr_lin(a,b);
	cout<<"\n";
	break;
	}	
}